﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.Utils;
using KQReport.Utils;

namespace KQReport
{
    public partial class FmMain : Form
    {
        public FmMain()
        {
            InitializeComponent();
        }

        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            tabControl.SelectedTabPageIndex = 0;
        }

        private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            tabControl.SelectedTabPageIndex = 1;
        }

        private void tabControl_SelectedPageChanged(object sender, DevExpress.XtraTab.TabPageChangedEventArgs e)
        {
            if (e.Page.TabIndex != 1) return;
            if (e.Page.Controls.Count > 0) return;
            var uc2 = new Uc2 {Dock = DockStyle.Fill};
            e.Page.Controls.Add(uc2);
        }

        private void FmMain_Load(object sender, EventArgs e)
        {
            Text = Conf.Name.Value;
            barButtonItem1.Caption = Conf.Analyse1.Value;
            barButtonItem2.Caption = Conf.Analyse2.Value;
            tabControl.ShowTabHeader = DefaultBoolean.False;
            var uc1 = new Uc1 {Dock = DockStyle.Fill};
            xtraTabPage1.Controls.Add(uc1);
        }

        private void barButtonItem3_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            new FmSettings().ShowDialog(this);
        }
    }
}
